{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "558a54a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Inspired by: https://www.youtube.com/watch?v=HjmIOKSp7v4&t=13s\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "d863d963",
   "metadata": {},
   "outputs": [],
   "source": [
    "j2l = 84\n",
    "j3l = 127"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "id": "9932acc5",
   "metadata": {},
   "outputs": [],
   "source": [
    "def render(v2, v3):\n",
    "    x1, y1 = [0, 200], [0, 0]  # x axis\n",
    "    x2, y2 = [0, 0], [-100, 100]  # y axis\n",
    "    plt.gca().invert_xaxis()\n",
    "    plt.plot(x1, y1, linestyle=\"dashed\", color=\"black\")\n",
    "    plt.plot(x2, y2, linestyle=\"dashed\", color=\"black\")\n",
    "\n",
    "    # Draw leg\n",
    "    voffset = np.deg2rad(90)\n",
    "\n",
    "    v2rad = np.deg2rad(v2)\n",
    "    v3rad = np.deg2rad(v3)\n",
    "\n",
    "    l1x = np.cos(v2rad) * j2l\n",
    "    l1y = np.sin(v2rad) * j2l\n",
    "\n",
    "    l2x = np.cos(v2rad + v3rad - voffset) * j3l\n",
    "    l2y = np.sin(v2rad + v3rad - voffset) * j3l\n",
    "\n",
    "    plt.plot([0, l1x], [0, l1y], color=\"red\", marker=\"o\")\n",
    "    plt.plot([l1x, l1x + l2x], [l1y, l2y + l2y], color=\"green\", marker=\"o\")\n",
    "\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8736e11",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_angles(z, y):\n",
    "    v3offset = np.deg2rad(\n",
    "        7\n",
    "    )  # foot is not directly under servo so zero angle do not have foot in in right place\n",
    "    # when angle is zero foot is too far off\n",
    "    l = np.sqrt(y**2 + z**2)\n",
    "    v3 = np.arccos((j2l**2 + j3l**2 - l**2) / (2 * j2l * j3l))\n",
    "    vb = np.arccos((j2l**2 + l**2 - j3l**2) / (2 * j2l * l))\n",
    "    va = np.arctan2(z, y)\n",
    "\n",
    "    v2 = vb - va\n",
    "    v3 = v3 - np.deg2rad(90)  # Adjust for the servo offset\n",
    "    v3 = v3 - v3offset  # Adjust for the foot offset\n",
    "\n",
    "    v2deg = np.rad2deg(v2)\n",
    "    v3deg = np.rad2deg(v3)\n",
    "    print(\n",
    "        f\"Calculated: l={l:.2f}, v2={v2deg:.2f},v3={v3deg:.2f}, vb={np.rad2deg(vb):.2f}, va={np.rad2deg(va):.2f}\"\n",
    "    )\n",
    "    return v2deg, v3deg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 219,
   "id": "e7190c25",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculated: l=128.06, v2=31.43,v3=-25.54, vb=70.09, va=38.66\n",
      "Calculated angles: v2 = 31.43, v3 = -25.54\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAGdCAYAAADnrPLBAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjMsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvZiW1igAAAAlwSFlzAAAPYQAAD2EBqD+naQAAOBxJREFUeJzt3Ql4VEW68PG3s2/sCUmQRVBUEBdARVQUlCEoM15cGEXnCoooiKMIqOAoAo7iA4OIK3pV8I4rzCfOFRgRERAHEEXRAYURZRNIUJFAQvac73mrp5tuSEII3X3O6fx/z1PmdHelrZPTy0vVW1Uey7IsAQAAcKkYuxsAAABwPAhmAACAqxHMAAAAVyOYAQAArkYwAwAAXI1gBgAAuBrBDAAAcDWCGQAA4GpxUg9UVlbKrl27pEGDBuLxeOxuDgAAqAVd1/fAgQPSokULiYmJqd/BjAYyrVq1srsZAACgDnbs2CEtW7as38GM9sj4/hgNGza0uzkAAKAW9u/f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KyYmxsrNzfXXef75562GDRtaJSUllpNou+fNm1djnf/6r/+yLr300qD72rRpY02fPt1yuqrOb9CgQeacqvPNN9+Y3/vss8/89/3jH/+wPB6PtXPnTstpanMN16xZY+pt27bN9dewsrLSysrKsqZOneq/T9+XiYmJ1ptvvunKa3i4u+++2zrppJPMuapLLrnE3OdmDz/8sHXWWWdV+VhtPlfd/t0RLdfxcOedd541YsQI/+2KigqrRYsW1uTJk61IomfmKPLz883Ppk2bmp9r1641Ebd2a/toV2nr1q1l1apV5rb+1C7+zMxMfx2NVHUzLv2XoptoN++CBQtMF/3hdEhCu4Q7d+5shqCcMoxWG8uWLTNdwaeeeqoMHz5cfvnlF/9jev10WOKcc87x36fXW/f40l4At76OtXdNz8vt13DLli2Sm5sb9B7UvVu0ezvwPejWa6g9uq+99prccsstQRvjvv7665Keni6dOnWScePGmR44t9GhQB06bNeunek50+H42n6uuv27I5quY+BrVa9d4HXT95jejvR1qxcbTR7PbtsjR46UCy+80LzwlH6IJiQkHPGloIGLPuarExjI+B73PeYmOkSmY8CHd/fedddd0qVLF/NG1aE0fVNql+kTTzwhTqdDTHo+bdu2le+//14eeOABufzyy82bLzY21lwjDXQCxcXFmXN12/VTOvSiOTQDBw4M2gTOrdfQdw2qeo8Fvgfdeg01P2jfvn0mt8vnhhtukDZt2phA4OuvvzbXU4cOdQjRLTTY1OF2/QeEvs4mTpwoPXr0kPXr19fqc9Xt3x3Rch0D/fzzzyatoqr34saNGyWSCGZqoOOf+kYLHNetbzRfRv8FpYldgXSM1OfMM880H0S33367SYJz+pLd119/vf9Ye9C0/SeddJLprbnsssskmui/dn//+9+bhNnnn38+aq5hNHv55ZdNcK1feD6BuT76mtXEZ32tajCur1030HMKfL1pcKNf7HPmzDFJ3PXhuyMarqNTMcxUjTvvvNMkDS5dulRatmzpvz8rK8t0rem/nA4fjtHHfHUOz8L33fbVcYMVK1aYfzXceuutR62rH0w6RLF161ZxG+3y1m7fzZs3+6/R4clrem46O8ZN188XyGzbts0kJAb2yrj5GvquQVXvscD3oBuvoV6rDz/88KjvOb1WyveadSPthTnllFPMOdTmc9Xt3x3ReB3T09NNb3ZN78VIIZg5jP4LVl+M8+bNk48++sgMRQTq2rWrxMfHy5IlS/z36Re+jv12797d3Naf//rXv4I+TH1fJh07dhQ3/QtRz1ez049m3bp1Zqz08K59N/jxxx9Nzoz+K8l3/fRDVceCffS1oF3Hvg8ftwQymqOgX46aFxMt11Dfk/pBGfge1Hw0zYUJfA+68RrOmjXL/P11NuTRrpXyvWbdSKfJa4+EnkNtPlfd/t0RjdcxISHBXLvA66bvMb0d8esW0XRjFxg+fLjVqFEja9myZdbu3bv95eDBg/46w4YNs1q3bm199NFH1ueff251797dFJ/y8nKrU6dOVp8+fax169ZZ77//vpWRkWGNGzfOcoIDBw5YX375pSn6EnjiiSfMceBMl/z8fCslJcXMwjrcypUrzSwYPbfvv//eeu2118z53XTTTZbTz08fGzNmjJkhsWXLFuvDDz+0unTpYrVv394qLi72P0ffvn2tzp07W59++qn1ySefmMcHDhxoOUVN51haWmpdeeWVVsuWLc01Cnwd+2bTufkaqscff9xq3Lix9fe//936+uuvzey0tm3bWkVFRa65hofTWSD6uXL//fcH3b9582Zr0qRJ5rNGX7N6zu3atbMuvvhiy01Gjx5tPlf1HP75z39avXv3ttLT082sn9p8rrr9uyNaruPh3nrrLTOTcPbs2WYW4W233Wbem4GzeSOBYOYw+sFZVZk1a5a/jn5g3nHHHVaTJk3MF/5VV11lXrSBtm7dal1++eVWcnKyecPqG7msrMxygqVLl1Z5jjpl2eeFF14wbdcpk4dbu3at1a1bN/PGTUpKsjp06GA99thjQcGAU89PP1g0yNQvbp0KqtOThw4desQb75dffjFffGlpaWZK/c0332y+YJ2ipnPUD8rqXsf6e26/hkqnLD/00ENWZmam+SC97LLLrE2bNrnqGh5u0aJF5hwPP4/t27ebL7ymTZuacz355JOte++91/yDw02uu+46Kzs720pISLBOOOEEc1u/4I/lc9XN3x3Rch2r8vTTT5tAVK+tTtVevXq1FWke/U9k+4IAAABCh5wZAADgagQzAADA1QhmAACAqxHMAAAAVyOYAQAArkYwAwAAXI1gBgAAuBrBDAAAcDWCGQAA4GoEMwAAwNUIZgAAgKsRzAAAAHGz/w87xroNlILPbwAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "z = int(80)\n",
    "y = int(100)\n",
    "\n",
    "v2, v3 = calculate_angles(z, y)\n",
    "print(f\"Calculated angles: v2 = {v2:.2f}, v3 = {v3:.2f}\")\n",
    "\n",
    "render(v2, v3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c6cbf142",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ik",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
